/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package nueva.esperanza.modelo;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author mgcharuc
 */
@Entity
@Table(name = "CHEQUE",schema = "SYSTEM")
@SequenceGenerator(name="seqCheque", sequenceName="SYSTEM.CHEQUE_SEQ" )
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Cheque.findAll", query = "SELECT c FROM Cheque c"),
    @NamedQuery(name = "Cheque.findByIdcheque", query = "SELECT c FROM Cheque c WHERE c.idcheque = :idcheque"),
    @NamedQuery(name = "Cheque.findByNumerocheque", query = "SELECT c FROM Cheque c WHERE c.numerocheque = :numerocheque")})
public class Cheque implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @GeneratedValue(generator = "seqCheque")
    @Column(name = "IDCHEQUE")
    private BigDecimal idcheque;
    @Basic(optional = false)
    @Column(name = "NUMEROCHEQUE")
    private BigInteger numerocheque;
    @JoinColumn(name = "IDESTADOCHEQUE", referencedColumnName = "IDESTADOCHEQUE")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Estadocheque idestadocheque;
    @JoinColumn(name = "IDCHEQUERA", referencedColumnName = "IDCHEQUERA")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Chequera idchequera;

    public Cheque() {
    }

    public Cheque(BigDecimal idcheque) {
        this.idcheque = idcheque;
    }

    public Cheque(BigDecimal idcheque, BigInteger numerocheque) {
        this.idcheque = idcheque;
        this.numerocheque = numerocheque;
    }

    public BigDecimal getIdcheque() {
        return idcheque;
    }

    public void setIdcheque(BigDecimal idcheque) {
        this.idcheque = idcheque;
    }

    public BigInteger getNumerocheque() {
        return numerocheque;
    }

    public void setNumerocheque(BigInteger numerocheque) {
        this.numerocheque = numerocheque;
    }

    public Estadocheque getIdestadocheque() {
        return idestadocheque;
    }

    public void setIdestadocheque(Estadocheque idestadocheque) {
        this.idestadocheque = idestadocheque;
    }

    public Chequera getIdchequera() {
        return idchequera;
    }

    public void setIdchequera(Chequera idchequera) {
        this.idchequera = idchequera;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idcheque != null ? idcheque.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cheque)) {
            return false;
        }
        Cheque other = (Cheque) object;
        if ((this.idcheque == null && other.idcheque != null) || (this.idcheque != null && !this.idcheque.equals(other.idcheque))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "nueva.esperanza.modelo.Cheque[ idcheque=" + idcheque + " ]";
    }
    
}
